from django.http import  HttpResponse
from django.shortcuts import render

# Create your views here.



# def index(request,id):
#     print(id)
#     data = f'你好,我是顾轩,{id}'
#     return HttpResponse(data)
from django.template.loader import get_template
from django.urls import reverse


def index(request,age):
    print(age)
    data = f'你好,我是顾轩,{age}'
    return HttpResponse(data)


def index2(request,username,age):

    data = f'你好,我是{username},我今年{age}'
    return HttpResponse(data)


def index3(request):
    return  HttpResponse("浏览器地址栏的路由是{}".format(reverse('index3')))


# 第一种访问模板的方法
# def hello(request):
#     t = get_template('drf21_01/hello.html')
#     html  = t.render()
#     return HttpResponse(html)


# 第二种

def hello(request):
    return  render(request,'drf21_01/hello.html')